import sys
sys.path.append("..")
import cryptography.sha256

sha256_file_path = "/Users/joe/Downloads/trace_oppo_r11.txt"
read_size = 91

if __name__ == "__main__":
    sha = cryptography.sha256.Sha256()
    f = open(sha256_file_path, mode='rb')
    i = 0
    read_size = 1024
    while True:
        data = f.read(read_size)
        if not data:
            break
        i += 1
        sha.add_data(data)
        print("data(%d bytes, %d): %s" % (len(data), i, data.hex()))
    # data = f.read()
    f.close()
    # print("data size  = %d " % len(data))
    # sha.add_data(data)
    hashvalue = sha.get_value()
    print(sha256_file_path + " hash value: " + hashvalue)


